1. Field of the Invention
The present invention relates to a semiconductor circuit device and a method of detecting runaway, more particularly relates to detection of runaway into a non-implementation space of a processor in the program execution.
2. Description of the Related Art
Recently, microprocessors are used in controllers of many kinds of electronic devices such as home electronic products, office automation equipment, vehicles and manufacturing apparatus as well as computer systems such as personal computers. A microprocessor has a control section which reads out data including instructions and addresses to control the entire microprocessor according to the command execution. The microprocessor further comprises an arithmetic section which executes an arithmetic operation and a logical operation, a register set which stores necessary data, and the like. Further, if the microprocessor is implemented as a controller of any kind of equipment, it may be equipped with memories such as a ROM and a RAM and other peripheral functions. The microprocessor decodes and processes sequentially instructions contained in a program so that a desired function is attained.
An instruction is fetched from an address indicated by a program counter in the register set. It is known that if a value of the program counter changes due to external noise, for example, the microprocessor might access to an unintended address and run away in the program execution. Thus, it is needed that the runaway should be automatically detected and a recovery process for the runaway should be started. Some methods for detecting runaway have been proposed. For example, one approach uses TRAP instructions located at dispersed addresses in a program stored in a ROM so that the TRAP process causes the recovery program to start.
Japanese Unexamined Patent Publication No. 2004-151846 discloses a method for detecting the runaway of a microprocessor. The microprocessor disclosed therein comprises a runaway detecting counter which works all the time. If the runaway detecting counter overflows, it determines that runway occurs and puts out an abnormal signal to a CPU. Then, the microprocessor clears the runaway detecting counter at a predetermined timing during a normal operation. This causes the runaway detecting counter not to overflow but to detect the runaway which is different from the normal operation.
Specifically, the microprocessor monitors program execution addresses and clears the runaway detecting counter when it executes a registered predetermined address. The microprocessor also clears the runaway detecting counter if all factors of peripheral hardware of the microprocessor are operating properly. The hardware directly clears runaway detecting counter but not via software or program. Thus, the microprocessor can prevent clearing accidentally the runaway detecting counter during runaway in a program execution and can detect the runaway in program execution without fail.
Typically, a program space provided to a CPU includes an implementation space allocated to implemented hardware such as a ROM and a RAM, as well as a non-implementation space which is not associated with implemented hardware. Therefore, it has now been discovered that, in the above-described related art, the microprocessor using TRAP instructions in the program in the ROM cannot detect runaway into the non-implementation space where any program is not stored, as well as the microprocessor described in the above Patent Publication, which detects the normal program execution so as to clear the runaway detecting counter. Consequently, a method to detect runaway into the non-implementation space is required.